package com.zemo.base.common.validation;

import com.zemo.base.common.enums.ErrorCodeEnum;
import com.zemo.base.common.exception.InvalidParamException;

/**
 * @description
 * @author: junwang.liu
 * @date Created in 下午3:49 2018/1/3
 */
public class PaymentAssert {

    public static void isTrue(boolean expression, String message) {
        if (!expression) {
            throw new InvalidParamException(ErrorCodeEnum.INVALID_PARAM, message);
        }
    }

    public static void notNull(Object object, String message) {
        if (object == null) {
            throw new InvalidParamException(ErrorCodeEnum.INVALID_PARAM, message);
        }
    }

    public static void hasText(String text, String message) {
        if (text == null || text.trim().length() <= 0) {
            throw new InvalidParamException(ErrorCodeEnum.INVALID_PARAM, message);
        }
    }

}
